package vip.liux.contracts.repositories.files;

import jakarta.annotation.Nullable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.ListCrudRepository;
import org.springframework.data.repository.ListPagingAndSortingRepository;
import org.springframework.data.repository.NoRepositoryBean;
import vip.liux.contracts.models.files.DirectoryDescriptor;

import java.util.List;

@NoRepositoryBean
public interface DirectoryDescriptorRepository extends ListPagingAndSortingRepository<DirectoryDescriptor, Long>, ListCrudRepository<DirectoryDescriptor, Long> {

    DirectoryDescriptor findByName(String name, @Nullable Long parentId);

    int getChildrenCount(@Nullable Long parentId);

    long findByParent(Long parentId);

    List<DirectoryDescriptor> getChildren(@Nullable Long parentId, String filter, Sort sort);

    List<Long> getChildren(@Nullable Long id);

    List<DirectoryDescriptor> getAllChildren(@Nullable Long id);
}
